details.dropdown {
  position: relative;

  &.fix-height {
    height: max-content;
  }

  summary {
    list-style: none;
    display: flex;
    align-items: baseline;

    &::before,
    &::marker {
      display: none;
      list-style: none;
    }
  }

  &[open] .dropdown-content {
    animation: dropdown 0.2s ease-in-out;
  }

  .dropdown-content {
    position: absolute;
    top: 100%;
    min-width: 160px;
    max-width: 400px;
    padding: 0;
    margin-top: 2px;
    list-style: none;
    background: white;
    border: 1px var(--grey-lighter) solid;
    border-radius: 0.25rem;
    z-index: 1000;
    box-shadow: var(--shadow-light);

    &::before,
    &::after {
      position: absolute;
      display: inline-block;
      content: " ";
    }

    &::before {
      border: 8px solid transparent;
      border-bottom-color: rgb(27 31 35 / 0.15);
    }
    &::after {
      border: 7px solid transparent;
      border-bottom-color: white;
    }

    .dropdown-item,
    a.dropdown-item,
    button.dropdown-item {
      display: block;
      padding: 4px 16px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: var(--color-grey-dark);
      text-decoration: none;
      i {
        margin-right: 8px;
      }
      &:hover {
        background-color: var(--color-primary-lighter);
        text-decoration: none;
      }
      &:first-child {
        border-top-left-radius: var(--size-border-radius);
        border-top-right-radius: var(--size-border-radius);
      }
      &:last-child {
        border-bottom-left-radius: var(--size-border-radius);
        border-bottom-right-radius: var(--size-border-radius);
      }
      transition:
        color 0.15s ease-in-out,
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
    }
    button.dropdown-item {
      width: 100%;
      text-align: left;
      font-family: var(--font-family);
      font-weight: normal;
      border-radius: 0;
    }
    hr {
      width: 100%;
      margin-top: 4px;
      margin-bottom: 0;
      padding-bottom: 4px;
      border: none;
      border-top: 1px solid var(--color-border);
    }
  }
  .dropdown-content-w {
    top: 0;
    right: 100%;
    left: auto;
    width: auto;
    margin-top: 0;
    margin-right: 8px;
  }
  .dropdown-content-w::before {
    top: 10px;
    right: -16px;
    left: auto;
    border-color: transparent;
    border-left-color: rgb(27 31 35 / 0.15);
  }
  .dropdown-content-w::after {
    top: 11px;
    right: -14px;
    left: auto;
    border-color: transparent;
    border-left-color: #fff;
  }
  .dropdown-content-e {
    top: 0;
    left: 100%;
    width: auto;
    margin-top: 0;
    margin-left: 8px;
  }
  .dropdown-content-e::before {
    top: 8px;
    left: -16px;
    border-color: transparent;
    border-right-color: rgb(27 31 35 / 0.15);
  }
  .dropdown-content-e::after {
    top: 11px;
    left: -14px;
    border-color: transparent;
    border-right-color: #fff;
  }
  .dropdown-content-ne {
    top: auto;
    bottom: 100%;
    left: 0;
    margin-bottom: 3px;
  }
  .dropdown-content-ne::before,
  .dropdown-content-ne::after {
    top: auto;
    right: auto;
  }
  .dropdown-content-ne::before {
    bottom: -8px;
    left: 9px;
    border-top: 8px solid rgb(27 31 35 / 0.15);
    border-right: 8px solid transparent;
    border-bottom: 0;
    border-left: 8px solid transparent;
  }
  .dropdown-content-ne::after {
    bottom: -7px;
    left: 10px;
    border-top: 7px solid #fff;
    border-right: 7px solid transparent;
    border-bottom: 0;
    border-left: 7px solid transparent;
  }
  .dropdown-content-s {
    right: 50%;
    left: auto;
    transform: translateX(50%);
  }
  .dropdown-content-s::before {
    top: -16px;
    right: 50%;
    transform: translateX(50%);
  }
  .dropdown-content-s::after {
    top: -14px;
    right: 50%;
    transform: translateX(50%);
  }
  .dropdown-content-sw {
    right: 0;
    left: auto;
  }
  .dropdown-content-sw::before {
    top: -16px;
    right: 9px;
    left: auto;
  }
  .dropdown-content-sw::after {
    top: -14px;
    right: 10px;
    left: auto;
  }
  .dropdown-content-se::before {
    top: -16px;
    left: 9px;
  }
  .dropdown-content-se::after {
    top: -14px;
    left: 10px;
  }
}

@keyframes dropdown {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
